'''
Created on 2016年2月22日

@author: Administrator
'''


from asyncore import dispatcher
import asyncore, socket

class ChatServer(dispatcher):
    
    def handle_accept(self):
        conn, addr = self.accept()
        print('connection attempt form', addr[0])
        print('connection attemp from port:', conn)
        
s = ChatServer()
s.create_socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind(('', 5005))
s.listen(5)
asyncore.loop()
